home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.04 Apr 95 / TreeAppƒ / Application Shellƒ / CPPTreeAppAboutBox.cp < prev    next >
Encoding:
Text File  |  1996-04-04  |  2.5 KB  |  105 lines  |  [TEXT/KAHL]

  1. /***************************************************** IMPLEMENTATION
  2.     DATE:    11/30/93
  3.     AUTHOR: Eric R. Rosé
  4.  
  5.     CLASS:  CPPTreeAppAboutBox
  6.     
  7.     SUPERCLASS: CPPWindow
  8.     
  9.         This C++ class manages the Yenta about box dialog
  10.     
  11. ********************************************************************/
  12.  
  13. #include "CPPTreeAppAboutBox.h"
  14. #include <CPPWindowManager.h>
  15. #include <CPPButton.h>
  16. #include <CPPStaticText.h>
  17. #include <ToolboxTools.h>
  18.  
  19.  
  20. extern    CPPWindowManager    *gWindowManager;
  21. extern    void DoStdOKButton (CPPWindow *theWindow);
  22. extern    void DoStdCancelButton (CPPWindow *theWindow);
  23.  
  24. Rect    AboutRect = {42, 20, 139, 195};
  25.  
  26. /*-----------------------------------------------------------------*/
  27. /*------------------------ PUBLIC METHODS -------------------------*/
  28. /*-----------------------------------------------------------------*/
  29.                           
  30.     CPPTreeAppAboutBox::CPPTreeAppAboutBox (CPPWindowManager *theManager) :
  31.                       CPPWindow (theManager, &AboutRect, "\pAbout", TRUE,
  32.                                    altDBoxProc, FALSE, 13, TRUE, FALSE, systemFont, 12)
  33.     {
  34.         GrafPtr    SavePort;
  35.         Rect    tempRect;
  36.         
  37.         GetPort(&SavePort);
  38.         SetPort(this->theWindow);
  39.         
  40.     //    create static text item
  41.         SetRect (&tempRect, 10, 10, 170, 50);
  42.         aboutText = new CPPStaticText ((CPPWindow *)this, &tempRect, 
  43.             "\pTreeApp v1.0\rwritten by Eric Rosé", 
  44.             systemFont, 12, teJustCenter);
  45.  
  46.     // create the dialog buttons
  47.         SetRect (&tempRect, 44, 63, 124, 83);
  48.         okButton = new CPPButton ((CPPWindow *)this, &tempRect, "\pOK", TRUE);
  49.         okButton->SetDoClickProc (DoStdOKButton);
  50.         
  51.         SetPort(SavePort);
  52.     }
  53.     
  54. /*-----------------------------------------------------------------*/
  55.  
  56.     CPPTreeAppAboutBox::~CPPTreeAppAboutBox ()
  57.     {
  58.         
  59.     }
  60.  
  61. /*-----------------------------------------------------------------*/
  62.  
  63.     char    *CPPTreeAppAboutBox::ClassName (void)
  64.     {
  65.         return "CPPTreeAppAboutBox";
  66.     }
  67.     
  68. /*-----------------------------------------------------------------*/
  69.  
  70.     Boolean    CPPTreeAppAboutBox::DoUserKey (EventRecord *theEvent)
  71.     {
  72.         char theKey;
  73.         CPPList    *TempList;
  74.  
  75.         theKey = theEvent->message & charCodeMask;
  76.           switch (theKey) {
  77.               case kEnter :
  78.               case kReturn :
  79.                   if (okButton)
  80.                     okButton->SimulateClick();
  81.               default:
  82.                   return TRUE;
  83.                   break;
  84.         } // switch
  85.  
  86.     }
  87.  
  88. /*-----------------------------------------------------------------*/
  89.     
  90.     Boolean    DoAboutBox (void)
  91.     {
  92.         CPPTreeAppAboutBox    *theWindow;
  93.         Boolean            theResult;
  94.         
  95.         theWindow = new CPPTreeAppAboutBox (gWindowManager);
  96.           
  97.         if (theWindow)
  98.           {
  99.               theWindow->DoModalWindow ();
  100.               delete theWindow;
  101.               return theResult;
  102.           }
  103.         else
  104.           SysBeep(1);
  105.     }